import re

import requests

url = 'https://www.zmccx.com'

ret = requests.get(url)
obj1 = re.compile(r'<div class="nav">.*?<ul>.*?<li><a href=".*?">首页</a></li>'
                  r'(?P<li>.*?)<li><a href="/modules/article/bookcase.php" rel="nofollow">我的书架</a></li>.*?</ul>', re.S)
obj2 = re.compile(r'<a href="(?P<href>.*?)">(?P<name>.*?)</a>')
context_li_list = obj1.finditer(ret.text)



for li in context_li_list:
    list_li = obj2.finditer(li.group('li'))
    for i in list_li:
        name = i.group('name')
        href = url +i.group('href')
        print(name,href)


ret.close()
